import Vue from 'vue'

import App from './App'
import router from './router'
import store from './store'
import db from './utils/datastore'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.config.productionTip = false

Vue.prototype.$db = db

db.get('config').then(res => {
	if (!res) {
		db.insert('config', {
			companyName: '',
			projectName: '',
			bootPath: '',
			templatesPath: '',
			corePath: 'aspnet-core/src',
			domainPath: '{{companyName}}.{{projectName}}.Domain',
			domainContractsPath: '{{companyName}}.{{projectName}}.Domain.Contracts',
			applicationPath: '{{companyName}}.{{projectName}}.Application',
			entityFrameworkCorePath: '{{companyName}}.{{projectName}}.EntityFrameworkCore',
			hostPath: '{{companyName}}.{{projectName}}.HttpApi.Host',
			vuePath: 'vue/src',
			vueViewsPath: 'src/views',
			vueRouterPath: 'src/router'
		})
	}
})

/* eslint-disable no-new */
new Vue({
	components: { App },
	router,
	store,
	template: '<App/>'
}).$mount('#app')
